package com.qf.blog.dto;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * User: key
 * ClassName:MyPage
 * Date: 2023/6/2
 * Time: 20:14
 * description:
 */
@Data
public class MyPage<T> extends Page<T> {

    private String path; // 点击下一页发送的请求地址

    public MyPage() {
        super.setSize(5);
    }
    public Long getFrom() {
        long index =super.current-2;
        if(index<=0){
            return 1L;
        }
        return index;
    }

    public Long getTo() {
        long index =super.current+2;
        if(index>=super.getPages()){
            return super.getPages();
        }
        return index;
    }
}